<template>
    <view>
		<!-- 头部组件 -->
		<u-sticky z-index="1000" :offset-top="gaodu"  bgColor="#ffffff">
			<view class="d-kuan-10">
				<view class="d-beijing-bai d-yuanjiao-10 ">
					<view class="d-yuanjiao-10 d-neikuang-5 ">
						<u-row
							customStyle="margin-bottom: 10px"
							gutter="10"
						>
							<u-col span="4">
								<view class="demo-layout bg-purple d-neirong-juzhong d-box d-quxian-0">
									<a class="d-wenzi-yanse-hui " :href="weixinkefu.pages && weixinkefu.pages.kefuurl" target="_blank" :textvalue="weixinkefu.pages && weixinkefu.pages.kefuurl">
									<image mode="aspectFill" src="/static/images/zaixiankefu.png" class="d-yuanjiao-10 d-img-40 d-shang-10" ></image>
									
									<view class="d-wenzi-yanse-hui d-ziti-12">人工客服</view>
									</a>
								</view>
							</u-col>
							<u-col span="4">
								<view class="demo-layout bg-purple d-neirong-juzhong d-box" @click="zhineng()">
									
									<image mode="aspectFill" src="/static/images/zhinengkefu.png" class="d-yuanjiao-10 d-img-40 d-shang-10" ></image>
									
									<view class="d-wenzi-yanse-hui d-ziti-12">智能客服</view>
								</view>
							</u-col>
							<u-col span="4">
								<view class="demo-layout bg-purple d-neirong-juzhong d-box" @click="bangzhu()">
		
									<image mode="aspectFill" src="/static/images/bangzhu.png" class="d-yuanjiao-10 d-img-40 d-shang-10" ></image>
									
									<view class="d-wenzi-yanse-hui d-ziti-12">帮助中心</view>
								</view>
							</u-col>
						</u-row>
					</view>
				</view>
			</view>
		</u-sticky>
		<view class="d-kuan d-gao-100"></view>
		<view class="d-kuan">
			<view class="d-kuan d-neirong-juzhong ">
				<image class="d-kuanggao-250" :src="weixinkefu.erweima"></image>
				<view class="d-jiacu"> 长按二维码 </view>
				<view class="d-jiacu d-shang-10 d-quxian-0" > 
				
				<a class="d-wenzi-yanse-hui " :href="weixinkefu.pages && weixinkefu.pages.kefuurl" target="_blank" :textvalue="weixinkefu.pages && weixinkefu.pages.kefuurl">【快速点击链接】</a>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
import toubu from "@/components/toubu/toubu";  //引入组件
import Dwaterfall  from "@/components/d-waterfall/d-waterfall";  //引入组件
var Api = require("../../utils/api.js");
var util = require("../../utils/util.js");

var wxApi = require("../../utils/wxApi.js");
var wxRequest = require("../../utils/wxRequest.js");
import config from "../../utils/config";
var pageCount = config.getPageCount;
var webSiteName = config.getWebsiteName;
var domain = config.getDomain;
var topNav = config.getIndexNav;
var banbenhao = config.getDuixinbanbenhao;

export default {
  data() {
    return {
	  uid:'',
	  userInfo:'',
	  keycode:'',
	  gaodu:'',
	  weixinkefu:[]
    };
  },


  components: {
	  toubu,
	  Dwaterfall
  },
  props: {},
  onShareAppMessage: function () {
    return {
      title: '“' + webSiteName + '”小程序',
      path: 'pages/index/index',
      success: function (res) {// 转发成功
      },
      fail: function (res) {// 转发失败
      }
    };
  },
  onPullDownRefresh: function () {
    var self = this;
  },
  onReachBottom: function () {
    var self = this;
    
  },
  onLoad: function (options) {
	  var duixin = this;
    uni.setNavigationBarTitle({
      title: '在线客服'
    });
	duixin.getDangqianurl();//获取当前网址
	duixin.getGaodu();
    duixin.getWeixinkefuData();
	var isFirstStorage = uni.getStorageSync('isFirst'); // console.log(isFirstStorage);
	var userInfo = uni.getStorageSync('userInfo');
	var keycode = uni.getStorageSync('keycode');
	duixin.userInfo = userInfo;
    duixin.keycode = keycode;

	if (userInfo) {
		duixin.showuid = true;
		var member = uni.getStorageSync('member');
		var uid = uni.getStorageSync('memberuid');
		duixin.uid = uid;
	} else {

	}
  },


  onShow() {
  },
    methods: {
		getGaodu(){
		  var duixin = this;
		
		  // #ifdef H5 || APP-PLUS
		   duixin.gaodu='0';
		  // #endif
		  // #ifdef MP
				duixin.gaodu='0';
		  // #endif
		},
		//获取当前页面
		getDangqianurl() {
			//获取当前页面栈的实例
			let pages = getCurrentPages();
			//获取当前页面
			let currentPage = pages[pages.length-1].$page.fullPath;
			let url = currentPage;
			uni.setStorageSync('dangqianUrl', url);
		},
		//微信客服接口
		getWeixinkefuData(){
			var duixin = this;
			//console.log('xx'); 
			var getWeixinkefuRequest = wxRequest.getRequest(Api.getWeixinkefu());
			getWeixinkefuRequest.then(response => {
				if (response.data.code == 1) {
				  //console.log(response.data.data); 
				  duixin.weixinkefu = response.data.data
				} else {
				  duixin.setData({
					displaySwiper: "none"
				  });
				}
			});
		},
		//人工客服
		rengong(){
			var duixin = this;
			var url = duixin.weixinkefu.pages && duixin.weixinkefu.pages.kefuurl
			//console.log('uu',url);
			uni.navigateTo({
				url: url // 目标页面的路径
			});
		},
		bangzhu(){
			uni.navigateTo({
				url: "/pages/bangzhu/bangzhu" // 目标页面的路径
			});
		},
		zhineng(){
			uni.showToast({
			  title: "即将上线，敬请期待",
			  icon: 'none',
			  mask: false,
			  duration: 1000
			});
			/*uni.navigateTo({
				url: url // 目标页面的路径
			});*/
		}

    },
	computed: {
		
	},

};
</script>
<style lang="scss">

</style>